//
//  LLTitleView.m
//  Weibo
//
//  Created by 李灵斌 on 15-1-29.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "LLTitleView.h"

@implementation LLTitleView

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self setup];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder{
    
    if (self = [super initWithCoder:aDecoder]) {
        [self setup];
    }
    return self;
}

- (void)setup{
    
    [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.titleLabel.font = [UIFont boldSystemFontOfSize:17];
    
//    [self adjustsImageWhenHighlighted] = NO;
    self.adjustsImageWhenHighlighted = NO;

}

- (void)setTitle:(NSString *)title image:(NSString *)image selectImage:(NSString *)selectImage{
    
    [self setTitle:title forState:UIControlStateNormal];
    [self setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [self setImage:[UIImage imageNamed:selectImage] forState:UIControlStateSelected];
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
//    self.imageView.x = self.titleLabel.x;
    self.titleLabel.x = self.imageView.x;
    self.imageView.x = self.width - self.imageView.size.width;


}

//- (void)sizeToFit{
//    [super sizeToFit];
//    self.imageEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0);
//}

//- (void)setHighlighted:(BOOL)highlighted{}

@end
